import pytest
from utils.database_backup_tool import DatabaseBackupTool


def pytest_addoption(parser):
    parser.addoption(
        "--headless",
        action="store_true",
        default=False,
        help="Run tests in headless mode"
    )


@pytest.fixture(scope="session")
def chrome_options(pytestconfig):
    options = {}
    if pytestconfig.getoption("headless"):
        options["headless"] = True
    return options


@pytest.fixture(scope="module")
def default_dirs(tmp_path_factory):
    """为所有测试提供默认目录"""
    return {
        "download": str(tmp_path_factory.mktemp("download")),
        "backup": str(tmp_path_factory.mktemp("backup")),
        "logs": str(tmp_path_factory.mktemp("logs"))
    }